#ifndef BINTREE_H
#define BINTREE_H

#define SKILL_NAME_LEN 32

typedef struct BinTreeNode {
    char skill[SKILL_NAME_LEN];
    struct BinTreeNode* left;
    struct BinTreeNode* right;
} BinTreeNode;

// 基本操作
BinTreeNode* bintreeCreate(const char* skill);
void bintreeInsertLeft(BinTreeNode* parent, BinTreeNode* child);
void bintreeInsertRight(BinTreeNode* parent, BinTreeNode* child);
void bintreeFree(BinTreeNode* root);

// 遍历
void bintreePreOrder(BinTreeNode* root, void (*visit)(BinTreeNode*));
void bintreeInOrder(BinTreeNode* root, void (*visit)(BinTreeNode*));
void bintreePostOrder(BinTreeNode* root, void (*visit)(BinTreeNode*));

// 统计
int bintreeDepth(BinTreeNode* root);
int bintreeNodeCount(BinTreeNode* root);
int bintreeLeafCount(BinTreeNode* root);

#endif 